package json;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.json.JSONObject;

import java.util.LinkedHashMap;

/**
 * @Author: DRevelation
 * @Date: 2021/8/26 15:19
 */
public class JsonDemo {
    public static void main(String[] args) {
        JSONObject obj = new JSONObject(true);
        obj.put("姓名", "江德华");
        obj.put("年龄", "24");
        obj.put("电话号码", "18255656762");
        obj.put("证件照", "url");

        System.out.println("obj = " + obj);
        LinkedHashMap<String, String> jsonMap1 = JSON.parseObject(obj.toString(), new TypeReference<LinkedHashMap<String, String>>() {
        });

        System.out.println("jsonMap1 = " + jsonMap1);
    }
}
